package com.foxwho.springbootunittesting.model;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateSerializer;
import lombok.Data;

import java.time.LocalDate;

@Data
public class Book {
    /**
     * id
     */
    private Integer id;
    /**
     * 名字
     */
    private String name;
    /**
     * 作者
     */
    private String author;
    /**
     * 出版时间
     */
    @JsonSerialize(using = LocalDateSerializer.class)
    @JsonFormat(pattern = "yyyy-MM-dd")
    private LocalDate date;
    public Book(){

    }
    public Book(Integer id, String name, String author, LocalDate date) {
        this.id = id;
        this.name = name;
        this.author = author;
        this.date = date;
    }
}
